<template>
  <fade>
    <div class="container" @click="handleClose">
      <div class="wrapper">
        <swiper :options="swiperOption">
          <swiper-slide v-for="(item, index) in gallery" :key="index">
            <img :src="item" alt="">
          </swiper-slide>
          <div class="swiper-pagination" slot="pagination"></div>
        </swiper>
      </div>
    </div>
  </fade>
</template>

<script>
import Fade from '@common/fadeAnimation/FadeAnimation'
export default {
  name: 'PhotoSwiper',
  components: {
    Fade
  },
  props: {
    gallery: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: {
          el: '.swiper-pagination',
          type: 'fraction'
        },
        observeParents: true,
        observer: true
      }
    }
  },
  methods: {
    handleClose () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
.container
  position fixed
  z-index 99
  top 0px
  bottom 0px
  left 0px
  right 0px
  background-color #000
  display flex
  align-items center
  .wrapper
    height 0
    width 100%
    padding-bottom 100%
    .swiper-container
      overflow visible
      img
        width 100%
      .swiper-pagination
        color #fff
        bottom -2rem
</style>
